<%@ page contentType="text/html;charset=UTF-8" language="java" %>




<html>
<head><title>TimeZone - Admin Mode</title></head>
<BODY>
<H1>User information</H1>
<%--

<%

    ResultSet resultset = DBUtil.getInstance().getUsers();

    XMLUtil.getInstance().parseDocument();

    XMLUtil parser = XMLUtil.getInstance();

    HashMap<String, Integer> locationGmt = parser.getLocationTimes();

    ArrayList<User> userList = new ArrayList<User>();



    while (resultset.next()) {
        User user  = new User();
        user.setId(resultset.getInt(1));
        user.setName(resultset.getString(2));
        user.setAddress(resultset.getString(3));
        user.setBirthday(resultset.getString(4));
        user.setLatitude(resultset.getString(5));
        user.setLongitude(resultset.getString(6));
        user.setPass(resultset.getString(7));
        user.setAdmin(resultset.getInt(8));
        if(locationGmt.containsKey(user.getAddress().toLowerCase()))
                user.setGmt(locationGmt.get(user.getAddress().toLowerCase())) ;
        else user.setGmt(13);

        userList.add(user);
    }
    HttpSession sess = request.getSession();
    sess.getAttribute("id");


    


%>



    <TABLE BORDER="1">
        <TR>
            <th>ID</th>
            <TH>Name</TH>
            <TH>Address</TH>
            <TH>Birth Date</TH>
            <TH>Latitude</TH>
            <TH>Longitude</TH>
            <th>GMT</th>
            <th>  </th>
            <th>  </th>
        </TR>
        <% for(User u : userList ){ %>
        <TR>
            <TD> <%= u.getId() %></td>
            <TD> <%= u.getName()%></TD>
            <TD> <%= u.getAddress()%></TD>
            <TD> <%= u.getBirthday()%></TD>
            <TD> <%= u.getLatitude() %></TD>
            <td> <%= u.getLongitude()%></td>
            <td> <%= u.getGmt() != 13?u.getGmt():"N/A"%> </td>

            <td><a href="/TimeZone/jsp/edituser.jsp?id=<%=u.getId()%>" ><strong>Edit</strong></a></td>
          <td><a href="/TimeZone/jsp/deleteuser.jsp?id=<%=u.getId()%>" ><strong>Delete</strong></a></td>

        </TR>
        <% } %>
    </TABLE>

    

   <a href="/TimeZone/jsp/createuser.jsp"><strong>Create</strong></a>


<hr/>

   <a href="/TimeZone/jsp/login.jsp"><strong>LogOut</strong></a>

<hr/>
--%>


</BODY>



</html>